home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
rexx
/
lookupword.epxx
< prev
next >
Wrap
Text File
|
1996-07-28
|
3KB
|
92 lines
/************************************************************************/
/* */
/* File : LookUpWord.epxx */
/* Author : Martin Reddy */
/* Date : 28/8/92 */
/* Purpose : An ARexx script used to control the text editor EdWord */
/* Note : This is part of the Spell Checking facility of EdWord */
/* Function : This script prompts the user for a string and then checks */
/* to see if this string is in the dictionary. The user is */
/* informed of the result and, if the word was not found, */
/* then upto 4 possible suggestions are made. */
/* Updates : [28/8/96] optionally add words to dictionary if not found */
/* */
/************************************************************************/
/*-------------- Nothing To Change Below Here -----------*/
HOST = ADDRESS()
ADDRESS VALUE HOST
OPTIONS RESULTS
/********** Make sure that the ISpell process is up *********/
IF ~SHOW( PORTS, 'IRexxSpell' ) THEN DO
Message "Loading Dictionary..."
ADDRESS COMMAND 'run <nil: >nil: EdSpell:ISpell/ispell -r >nil: <nil:'
ADDRESS COMMAND 'EdSpell:ISpell/WaitForPort IRexxSpell'
IF RC ~= 0 THEN DO
Inform "Could Not Start ISpell Process|Spell Check Aborted!"
Message ""
EXIT
END
END
/**************** Get a Word From The User *****************/
GetInput "Enter Word To Look Up In Dictionary :"
IF RESULT ~= "RESULT" THEN DO
/**************** Now check the word ****************/
SEARCHWORD = COMPRESS( UPPER(RESULT), '~`,./<>?;:"[]{}!@#$%^&*()+|=\- ' )
ADDRESS "IRexxSpell" CHECK SEARCHWORD
WORD = RESULT
IF WORD == "*" THEN DO
Inform SEARCHWORD" Found In Dictionary|Word Is Spelt Correctly"
EXIT
END; ELSE IF LEFT(WORD,1) == "+" THEN DO
PARSE VAR WORD DUMMY ROOT
Choice SEARCHWORD" Is A Valid Combination|But Is Not In Dictionary|(Root Word Is "ROOT")@@Okay|Add Word"
END; ELSE IF LEFT(WORD,1) == "&" THEN DO
PARSE VAR WORD DUMMY SUGA SUGB SUGC SUGD SUGE
SUG = "|1) "SUGA
IF (SUGB ~= "END") & (SUGB ~= "") & (SUGB ~= "SUGB") THEN DO
SUG = SUG||"|2) "||SUGB
END
IF (SUGC ~= "END") & (SUGC ~= "") & (SUGC ~= "SUGC") THEN DO
SUG = SUG||"|3) "||SUGC
END
IF (SUGD ~= "END") & (SUGD ~= "") & (SUGD ~= "SUGD") THEN DO
SUG = SUG||"|4) "||SUGD
END
Choice SEARCHWORD" Not In Dictionary|Possible Suggestions Are:|"||SUG||"@@Okay|Add Word"
END; ELSE DO
Choice SEARCHWORD" Not In Dictionary|No Possible Suggestions Found@@Okay|Add Word"
END
IF RC == 0 THEN DO
CALL AddWord( SEARCHWORD )
END
END
EXIT
/************ PROCEDURE: "AddWord(word)" ************/
AddWord: PROCEDURE
PARSE ARG THEWORD
Choice "Please Confirm The Addition of|"||THEWORD||" To The Dictionary.@@Add Word|Cancel"
IF RC ~= 0 THEN DO
ADDRESS "IRexxSpell" ADD THEWORD
END
RETURN